const express = require('express')
const app = express()
app.listen(3000, '0.0.0.0')
app.use(express.static('www'))

app.get('/ajax', (req, res) => {

  res.setHeader("content-type", "text/event-stream")

  setInterval(() => {
    let dt = Date.now()
    if (new Date().getSeconds() % 2 == 0) {
      res.write("event:message\ndata:" + dt + "\n\n")
    }
  }, 1000);


})

